package models;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.*;
import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import org.joda.time.DateTime;

import play.data.validation.Email;
import play.data.validation.Required;
import play.db.jpa.Model;
import play.libs.Mail;

@Entity
public class Notification extends Model
{ // Created by Tarek Sheasha
	@Required
	@ManyToOne
	private User	sender;		// User that sent the Invitation, Tarek Sheasha
	@Required
	@ManyToOne
	private User	receiver;	// User to receive the Invitation, Tarek Sheasha
	@Required
	private String	subject;	// Subject of the Invitation, Rania Nader
	@Required
	private String	content;	// Content of the Invitation, Tarek Sheasha
	@Required
	private Date	date; 		// Date Request was Invitation, Tarek Sheasha
	
	/**
	 *	Notification Empty Constructor
	 * 
	 * @author		Rania Nader Saeed
	 * @version 	2011.04.25
	 * @category 	C1
	 * @param		nothing    
	 * @return 		nothing
	 */
	public Notification()
	{
		sender		= new User();
		receiver	= new User();
		content		= "";
		subject		= "";
		date		= new Date();
	}
	
	/**
	 *Notification Constructor
	 * 
	 * @author Tarek Sheasha
	 * @version 2011.04.25
	 * @category C1
	 * @param sender: the sender of the notification,
	 *  receiver: the user that will receive the notification,
	 *  content: the content of the notification,
	 *  date : the date of the notification
	 *            
	 * @return nothing
	 */
	public Notification (User sender, User receiver, String subject, String content, String date) 
	{
		this.sender		= sender;
		this.receiver	= receiver;
		this.subject	= subject;
		this.content	= content;
		this.date		= new Date();
	}
	

	public User getSender() {
		return sender;
	}

	public void setSender(User sender) {
		this.sender = sender;
	}

	public User getReceiver() {
		return receiver;
	}

	public void setReceiver(User receiver) {
		this.receiver = receiver;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}
	
}
